<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";%>
<html>
    <head>
        <base href="<%=basePath%>">
        <style>
            span {
                color: red;
            }
        </style>
        <script src="/js/jquery.min.js"></script>
        <script>
            $(function () {
                //返回按钮
                $("#goback").click(function () {
                    window.history.back();
                });

                //验证userid 当输入域失去焦点 (blur) 时改变
                $("#uid").blur(function () {
                    var orderId = $(this).val();
                    console.log(orderId)
                    $.get("/order/checkOrderId", {"orderId": orderId}, function (data) {
                        $("#info").html(data);
                    });
                });
            });
        </script>
    </head>

    <body>
        <jsp:include page="/admin/top.jsp"/>
        <form name="form" action="/order/orderAdd" method="post">
            <div class="middle">
                <table class="zbox">
                    <tr>
                        <td width="10%">订单编号</td>
                        <td>
                            <input id="uid" name="orderid" type="text" placeholder="必填" required>
                            <span>*</span><span id="info"></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">订单日期</td>
                        <td>
                            <%--<input type="text" placeholder="必填" required>--%>
                            <label>
                                <input type="date" name="orderdate" required/>
                            </label>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">用户名</td>
                        <td>
                            <input name="userid" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">订单总数</td>
                        <td><input name="totalnum" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">订单价格</td>
                        <td><input name="totalamount" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">支付方式</td>
                        <td><input name="payment" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">订单快递</td>
                        <td><input name="deliver" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">订单接收人</td>
                        <td><input name="receiver" type="text" placeholder="必填" required>
                            <span>*</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">联系地址</td>
                        <td><input name="address" type="text" placeholder="请您提供尽可能详细的地址"></td>
                    </tr>
                    <tr>
                        <td width="10%">手机电话</td>
                        <td>
                            <input name="phone" type="tel" pattern="[0-9]{11}" placeholder="例：13704560465">
                        </td>
                    </tr>
                    <tr>
                        <td width="10%">邮编</td>
                        <td><input name="postcode" type="text" pattern="[0-9]{3,6}"></td>
                    </tr>
                    <tr>
                        <td width="10%">状态</td>
                        <td><select name="state">
                            <option value='0'>未激活</option>
                            <option value='1'>激活</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="submit" value="新建">&nbsp;&nbsp;
                            <input type="reset" value="重置">&nbsp;&nbsp;
                            <input id="goback" type="button" value="返回">
                        </td>
                    </tr>
                </table>
            </div>
        </form>
        <jsp:include page="/admin/bottom.jsp"/>
    </body>
</html>